'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const TopicCollectSchema = new Schema({
    user_id: {type: String},
    topic_id: {type: String},
    title: {type: String},
    original_url: {type: String},
    brief: {type: String},
    is_public: {type: Boolean, default: true},
    tags: []
  }, {timestamps: true});

  TopicCollectSchema.index({user_id: 1, topic_id: 1}, {unique: true});

  return mongoose.model('TopicCollect', TopicCollectSchema, 'topic_collects');
};
